package ru.papergames.model.binsocket.packets.response
{
	import flash.geom.Rectangle;
	import ru.papergames.model.vo.BallVO;
	import ru.papergames.model.vo.PositionVO;
	
	import ru.papergames.model.binsocket.data.ExtByteArray;
	import ru.papergames.model.binsocket.packets.SocketResponse;

	public class BattlePlayerMovedBallResponse extends SocketResponse
	{		
		public static const NOTIFICATION:String = 'BattlePlayerMovedBallResponse';
		
		public var battleOrderId:uint;		
		public var playerId:Number;
		public var coloreId:uint;
		public var route:Array;
		
		public function BattlePlayerMovedBallResponse(bytes:ExtByteArray)
		{
			super(bytes);
		}
		
		override protected function decode():void {
			
			battleOrderId = binaryData.readUnsignedInt();
			playerId = binaryData.readLong();
			coloreId = binaryData.readUnsignedShort();
			
			var routeSize:uint = binaryData.readUnsignedShort();			
			route = [];
			
			while (binaryData.bytesAvailable > 0 && routeSize-- > 0) {			
				var pos:PositionVO = new PositionVO( binaryData.readUnsignedShort(), binaryData.readUnsignedShort() );				
				route.push(pos);
			}
		}
		
		override public function getNotification():String {
			return NOTIFICATION;
		}
	}
}